/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sk.uniba.fmph.asdf.gui.views;

import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;

/**
 *
 * @author mt
 */
public abstract class View extends JFrame implements ActionListener {

    public View(final int operation) {
        super();
        setDefaultCloseOperation(operation);
    }

    /**
     * Inicializacia komponentov
     */
    protected abstract void initComponents();

    /**
     * Zobrazenie okna
     */
    public void display() {
        pack();
        setLocationRelativeTo(null);
        setVisible(true);
    }

    /**
     * Zatvorenie okna
     */
    public void closeWindow() {
        WindowEvent closingEvent = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(closingEvent);
    }

}
